namespace TomatoBreak.DomainObjects
{
    using System;
    using System.Diagnostics;

    [DebuggerDisplay("{Task.Name}-{OrderNo}")]
    public class ToDoItem : Entity
    {
        private int orderNo;
        private Task task;
        private ToDoList toDoList;

        [Obsolete("Used by the ORM")]
        public ToDoItem()
        {
        }

        public ToDoItem(int orderNo, Task task, ToDoList toDoList)
        {
            if (orderNo < 0)
            {
                throw new ArgumentOutOfRangeException(
                    "orderNo", ErrorMessages.ToDoItem_Ctor_NegativeOrderNo);
            }

            if (task == null)
            {
                throw new ArgumentNullException("task");
            }

            if (toDoList == null)
            {
                throw new ArgumentNullException("toDoList");
            }

            this.orderNo = orderNo;
            this.task = task;
            this.toDoList = toDoList;
        }

        public virtual int OrderNo
        {
            [DebuggerStepThrough]
            get { return orderNo; }

            [DebuggerStepThrough]
            protected set { orderNo = value; }
        }

        public virtual Task Task
        {
            [DebuggerStepThrough]
            get { return task; }

            [DebuggerStepThrough]
            protected set { task = value; }
        }

        public virtual ToDoList ToDoList
        {
            [DebuggerStepThrough]
            get { return toDoList; }

            [DebuggerStepThrough]
            protected set { toDoList = value; }
        }
    }
}